<!--<div class="user_content" xmlns:th="http://www.w3.org/1999/xhtml">-->
<link href="../../static/css/jeDate-test.css" rel="stylesheet" th:href="@{/css/jeDate-test.css}"/>
<link href="../../static/css/jedate.css" rel="stylesheet" th:href="@{/css/jedate.css}"/>
<script src="../../static/js/jquery.jedate.js" th:src="@{/js/jquery.jedate.js}"></script>
<script src="../../static/js/jedate-test.js" th:src="@{/js/jedate-test.js}"></script>
<div class="x_panel">
    <form action="#" id="findForm" method="post" class="form-horizontal" role="form">
        <div class="row">
            <div class="form-group">
                <label class="col-sm-1 control-label">事件编码：</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" name="eventCode" th:value="${publicSecurity?.eventCode}"/>
                </div>
                <label class="col-sm-1 control-label">事件标题：</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" name="eventTitle" th:value="${publicSecurity?.eventTitle}"/>
                </div>

                <label class="col-sm-1 control-label">发生位置：</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" name="eventLocation"
                           th:value="${publicSecurity?.eventLocation}"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-1 control-label">开始时间：</label>
                <div class="col-md-3">
                    <input name="onDate" class="form-control" id="time5" readonly="readonly" placeholder="YYYY-MM-DD" th:value="${publicSecurity?.onDate}"/>
                </div>
                <label class="col-md-1 control-label">结束时间：</label>
                <div class="col-md-3">
                    <input name="outDate" class="form-control" id="time4" readonly="readonly" placeholder="YYYY-MM-DD" th:value="${publicSecurity?.outDate}"/>
                </div>
                <div class="">
                    <button type="button" class="btn btn-primary pull-right" onclick="findForPublicSecurity()" style=" margin-right: 10px;">查询
                    </button>
                    <button type="button" class="btn btn-primary pull-right" onclick="resutForPublicSecurity()">重置
                    </button>
                </div>
            </div>


        </div>
    </form>

</div>
<div class="row">
    <div class="form-group">
        <div class="col-sm-1">

        </div>
    </div>
</div>
<div class="row" style="margin-top: 20px">
    <div class="table-responsive">
        <table class="table table-striped jambo_table bulk_action">
            <thead>
            <tr class="headings">
                <th class="column-title" style="display: table-cell;">编号</th>
                <th class="column-title" style="display: table-cell;">事件编码</th>
                <th class="column-title" style="display: table-cell;">事件标题</th>
                <th class="column-title" style="display: table-cell;">发生位置</th>
                <th class="column-title" style="display: table-cell;">上报日期</th>
                <th class="column-title" style="display: table-cell;">操作</th>
            </tr>
            </thead>

            <tbody>
            <tr class="even pointer" th:each="data,iterStat : ${datas?.content}">
                <td style="vertical-align: middle;" th:text="${iterStat.count}">1</td>
                <td style="vertical-align: middle;" th:text="${data.eventCode}">eventCode</td>
                <td style="vertical-align: middle;" th:text="${data.eventTitle}">eventTitle</td>
                <td style="vertical-align: middle;" th:text="${data.eventLocation}">eventLocation</td>
                <td style="vertical-align: middle;" th:text="${#dates.format(data.cdate, 'yyyy-MM-dd HH:mm:ss')}">
                    cdate
                </td>
                <td style="vertical-align: middle;">
                    <button class="fa fa-pencil-square-o btn btn-round btn-default" type="button" th:id="${data.publicSecurityId}" onclick="publicDetail(this)">详情</button>
                    <button class="fa fa-check-square btn btn-round btn-default" type="button" th:if="${data.publicSecurityContent != null}"
                           disabled>已处理
                    </button>
                    <button class="fa fa-square btn btn-round btn-default" type="button" th:if="${data.publicSecurityContent == null}"
                            th:id="${data.publicSecurityId}" th:attr="title=${data.eventTitle}" onclick="modelShow(this)">处理
                    </button>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div id="pagination" class="col-md-12 pagination" th:replace="pagination :: pagination">
    </div>
</div>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="model">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form action="#" id="modelForm" method="post" class="form-horizontal" role="form">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true" onclick="modelClean()">&times;</span></button>
                    <h4 class="modal-title" id="modelTitle"></h4>
                </div>
                <div class="modal-body">
                    <textarea
                            style="width: 100%;height: 100px; resize: none; box-shadow: 0px 0px 10px #333 inset; border:0" id="publicSecurityContent" name="publicSecurityContent" placeholder="请填写案件处理报告!"></textarea>
                    <input type="hidden" id="modelInput" name="publicSecurityId"/>
                </div>
            </form>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" onclick="modelClean()">关闭</button>
                <button type="button" class="btn btn-primary" onclick="modelSave()">提交</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/






    function findForPublicSecurity() {
        var begingDate1 = document.getElementById("kai3").value;
        var endDate1 = document.getElementById("kai4").value;

        if(begingDate1!='' && endDate1!='' && (getDate(begingDate1)-getDate(endDate1)>0)){
            $.MsgBox.Alert("提示", "束时间应大于开始时间！");
            $("#kai3").val("");
            $("#kai4").val("");
        } else {
            var findForm = $("#findForm").serialize();
            $.goTo(/*[[@{/publicsecurity/toPublicList}]]*/"./public_list.html", findForm);
        }
        function getDate(date){
            var dates = date.split("-");
            var dateReturn = '';

            for(var i=0; i<dates.length; i++){
                dateReturn+=dates[i];
            }
            return dateReturn;
        };




    }

    function resutForPublicSecurity() {
        $.goTo(/*[[@{/publicsecurity/toPublicList}]]*/"./public_list.html");
    }

    function modelShow(obj) {
        var id = $(obj).attr("id");
        var title = $(obj).attr("title");
        $("#modelInput").val(id);
        $("#modelTitle").text("");
        $("#modelTitle").text(title);
        $("#model").modal("show");
    }

    function modelClean() {
        $("#modelInput").val("");
        $("#modelTitle").text("");
        $("#publicSecurityContent").val("");
        $("#model").modal("hide");
    }

    function modelSave() {
        var publicSecurityContent = $("#publicSecurityContent").val();
        if(publicSecurityContent == "" || publicSecurityContent == null){
            $.MsgBox.Alert("提示", "必须填写案件处理报告!");
        }else{
            var modelForm = $("#modelForm").serialize();
            $.post("/publicsecurity/finishPublicSecurity", modelForm, function (result) {
                $.MsgBox.Alert("提示", result);
                $("#model").modal("hide");
                $(".modal-backdrop").hide();
                $.goTo(/*[[@{/publicsecurity/toPublicList}]]*/"./public_list.html");
            });
        }
    }

    function publicDetail(obj) {
        var id = $(obj).attr("id");
        $.goTo(/*[[@{/publicsecurity/publicSecurityDetail}]]*/"./public_list.html",{"id":id});
    }


    function up(number) {//分页跳转，上一页
        /*[+
         var findForm = $("#findForm").serialize();
         var number = parseInt(number);
         $.goTo("toEmpList?page="+number,findForm);
         +]*/
    }

    function next(number) {//分页跳转，下一页
        /*[+
         var findForm = $("#findForm").serialize();
         var number = parseInt(number) + 2;
         $.goTo("toEmpList?page="+number,findForm);
         +]*/
    }
    function pageTo(page) {
        /*[+
         var number = page;
         var findForm = $("#findForm").serialize();
         $.goTo("toEmpList?page=" + number,findForm);
         +]*/
    }
    /*]]>*/
</script>


